/* 
 * File:   StratifiedRNG.cpp
 * Author: brady
 * 
 * Created on August 21, 2011, 1:15 AM
 */

#include <core/StochasticRNG.h>

StochasticRNG::StochasticRNG() {
    randomSet = NULL;
}

StochasticRNG::StochasticRNG(const StochasticRNG& orig) {
}

StochasticRNG::~StochasticRNG() {
    if(randomSet != NULL){
        delete[] randomSet;
    }
}
void StochasticRNG::generateRandomSet(int size){
    if(randomSet != NULL){
        delete[] randomSet;
    }
    this->size = size;
    randomSet = new int[size];
    for (int i = 0; i<size; i++){
        randomSet[i] = i;
    }

    for (int j = 0; j<size; j++){
        int swapIndex = rand()%size;
        int temp = randomSet[j];
        randomSet[j] = randomSet[swapIndex];
        randomSet[swapIndex] = temp;
    }
}

const int* StochasticRNG::getRandomSet(){
    return randomSet;
}
